/*
 +----------------------------------------------------------------------
 + Title        : 商品接口
 + Author       : huwl
 + Version      : 1.0.0
 + Initial-Time : 2023-08-10
 + Last-time    : 这个文件最后修改的时间 + 修改人的名称
 + Desc         : 商品接口
 +----------------------------------------------------------------------
*/
import request from '@/utils/httpRequest'


/**
 * 商品详情
 * 
 *  @param number id-----------------------------------------商品ID
 *
 * return json
 * author huwl
 */
export const reqGetGoodsDetailAPI = (id) => {
  return request({
      method: 'GET',
      url: 'goods/detail',
      params: {id}
  })
}

/**
 * 商品列表
 * 
 *  @param object params----------------------------------------搜索参数
 *
 * return json
 * author huwl
 */
export const reqGetGoodsListAPI = (params) => {
  return request({
      method: 'GET',
      url: 'goods/search',
      params
  })
}

/**
 * 获取商品前缀搜索
 * 
 *  @param object params----------------------------------------搜索参数
 *
 * return json
 * author huwl
 */
export const reqGetGoodsPrefixSearchAPI = (params) => {
  return request({
      method: 'GET',
      url: 'goods/prefixSearch',
      params
  })
}

/**
 * 搜索建议自动补全
 * 
 *  @param string keyword --------------------------------------搜索关键词
 *
 * return json
 * author huwl
 */
export const reqSearchSuggestCompletionAPI = (keyword) => {
  return request({
      method: 'GET',
      url: 'goods/searchSuggestCompletion',
      params: {keyword}
  })
}

/**
 * 获取商品SKU列表
 * 
 *  @param object params----------------------------------------商品SKU参数
 *
 * return json
 * author huwl
 */
export const reqGetGoodsSkuListAPI = (params) => {
  return request({
      method: 'GET',
      url: 'goodsSku/list',
      params
  })
}

/**
 * 聚合商品列表搜索过滤项，如品牌,分类,尺码等
 * 
 *  @param object params----------------------------------------商品参数
 *
 * return json
 * author huwl
 */
export const reqSearchFilterAPI = (params) => {
  return request({
      method: 'GET',
      url: 'goods/searchFilter',
      params
  })
}

/**
 * 获取商品选项列表
 *
 * @param int id -------------------------------------------------------------非必传,商品选项ID
 * @param string ids ---------------------------------------------------------非必传,商品选项ID支持多个
 * @param string name --------------------------------------------------------非必传,名称
 * @param int goods_id -------------------------------------------------------非必传,商品ID
 * @param string goods_ids ---------------------------------------------------非必传,商品ID支持多个
 * @param int goods_type_id --------------------------------------------------非必传,商品类型ID
 * @param string goods_type_ids ----------------------------------------------非必传,商品类型ID支持多个
 * @param string start_create_time -------------------------------------------非必传,开始创建时间
 * @param string end_create_time ---------------------------------------------非必传,结束创建时间
 * @param string sort_type ---------------------------------------------------非必传,排序方式
 * @param string sort_field --------------------------------------------------非必传,排序字段
 * @param string page_size ---------------------------------------------------非必传,条数
 * @param string page --------------------------------------------------------非必传,页码
 * return json
 * author huwl
 */
export const reqGetGoodsOptionListAPI = (params) => {
  return request({
      method: 'GET',
      url: 'goodsOption/list',
      params
  })
}